Using Spin Controls

WPF Elements contains two spin controls: the Spin control itself, and the SpinDecorator. You can compose these with numeric controls to provide users with a convenient way of adjusting the values of such controls.

The Spin Control

The Spin control provides up-down functionality. You will typically use a Spin control by placing it next to an element which is databound to the same value. As the user clicks on the up and down buttons, the value changes.

The SpinDecorator Control

SpinDecorator encapsulates the pattern described above. A SpinDecorator adds spin functionality to a child control, typically a numeric text box (CurrencyTextBox, NumericTextBox or IntegerTextBox). A Spin control is displayed next to the child control; in addition, cursor up and down keys are interpreted as spin commands. (In fact you can optionally hide the Spin control user interface and just support cursor keys.)

By default, the SpinDecorator associated the spin behavior with the child control’s Value property. If the value property is not called Value, or you want the spin behavior to affect some other property, set SpinDecorator.ValueProperty to the name of the property you want to spin.

See Spinners.xaml in the Elements sample for examples.